# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ngircd
pkgver=25
pkgrel=1
pkgdesc="Next Generation IRC Daemon"
url="https://ngircd.barton.de/"
arch="all"
license="GPL-2.0-or-later"
makedepends="openssl-dev zlib-dev linux-pam-dev"
subpackages="$pkgname-doc $pkgname-openrc"
install="$pkgname.pre-install"
source="https://ngircd.barton.de/pub/ngircd/ngircd-$pkgver.tar.xz
	CVE-2020-14148.patch::https://github.com/ngircd/ngircd/commit/02cf31c0e267a4c9a7656d43ad3ad4eeb37fc9c5.patch
	$pkgname.initd
	"

# secfixes:
#   25-r1:
#     - CVE-2020-14148

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/ngircd \
		--mandir=/usr/share/man \
		--without-ident \
		--with-openssl \
		--with-pam \
		--enable-ipv6
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 ../$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="61f7606a13daeac3ff69c689ad53c7e8ff70fe4dff6acbfde6a5fd3b2d4e3c9a182d9fc1a93c9e470633ab7cd201c5469b9d39599c56d7c66271d0e295dfb1f4  ngircd-25.tar.xz
3863bab40dcb0283127497efa117ceaab3f4d1d427399ad262a1a3b24d50ff663578579639c9ea39b9be41698ad13767ee575071e46e8ba80eebbda1f3d58881  CVE-2020-14148.patch
50339507917c956a38451394a8a5996337ff29948944ff6aa40ed39f6dd3d6bfdfb864d60a24199c0a86a01e18a71f213efa6cfb2857a320f31b9fcfb92c6ac1  ngircd.initd"
